<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>getElmentById学习</title>

</head>

<body>

    <div id="time">2020-10-9</div>

    <script>
        //因为文档页面从上往下加载所以先得有标签、所以script标签得在下面
        //返回值是一个元素对象
        var s = document.getElementById('time');
        console.log(typeof(s));
        console.dir(s);
        console.log(s.textContent);
        console.log(s.outerHTML);
        console.log(s.outerText);
    </script>

</body>

</html>